home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000824-20010305 / 000163_news@columbia.edu _Fri Dec 29 14:12:37 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
  3.     by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id OAA29642
  4.     for <kermit.misc@cpunix.cc.columbia.edu>; Fri, 29 Dec 2000 14:12:36 -0500 (EST)
  5. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  6.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id OAA02773
  7.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 29 Dec 2000 14:12:36 -0500 (EST)
  8. Received: (from news@localhost)
  9.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id NAA09813
  10.     for kermit.misc@watsun.cc.columbia.edu; Fri, 29 Dec 2000 13:44:50 -0500 (EST)
  11. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  12. From: fdc@columbia.edu (Frank da Cruz)
  13. Subject: Re: Converting struct tm to time_t
  14. Date: 29 Dec 2000 18:44:49 GMT
  15. Organization: Columbia University
  16. Message-ID: <92im31$9ii$1@newsmaster.cc.columbia.edu>
  17. To: kermit.misc@columbia.edu
  18.  
  19. In article <yllmszt7lk.fsf@windlord.stanford.edu>,
  20. Russ Allbery  <rra@stanford.edu> wrote:
  21. : My code doesn't assume it's unsigned; it just won't generate negative
  22. : time_t values.  It works fine on systems with a signed time_t (basically
  23. : all of them).
  24. OK, great.
  25.  
  26. : I believe that both of these assumptions are required by POSIX; they're
  27. : certainly true on every UNIX system that I've ever seen.
  28. :
  29. But there are still lots of non-POSIX UNIXes running and I try to support
  30. them.
  31.  
  32. : > ...but gmtime() and localtime() are not among the most portable
  33. : > of UNIX APIs,
  34. : Really?  I've never seen a Unix system without them, and was under the
  35. : impression that they were introduced in the early 1980s.
  36. I don't mean you can't find them, but that using them in portable code
  37. is often problematic -- which header files to include, where are they,
  38. what are the argument types and where do you pick up their definitions, etc.
  39.  
  40. : > plus I don't know how consistent their semantics are across platforms,
  41. : > e.g. if you give them a seconds or minutes field greater than 60 or less
  42. : > than 0, etc.
  43. : Neither gmtime() nor localtime() take something that has a seconds or
  44. : minutes field, so I assume that you're talking about mktime().  mktime()'s
  45. : normalization of out-of-range values is a requirement of its definition,
  46. : which I believe is in ANSI C.
  47. Right, sorry, I meant mktime().  But again, just because some standard
  48. requires certain behavior doesn't make it happen, especially when some of
  49. the mktime() implementations precede the standard.
  50.  
  51. Anyway, I'll muddle through, thanks again.
  52.  
  53. - Frank